package interfaces2;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;

public class PointsMain2 {
	private static final String filename = "point2.data";

	/**
	 * @param args
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException, IOException {
		ArrayList<Point2D<?>> a = new ArrayList<Point2D<?>>();
		a.add( new Point2D<Integer>( 21, -43 ) );
		a.add( new Point2D<Double>( 2.54, 12.8 ) );
		a.add( new Point2D<Float>( -0.23f, 34.7f ) );
		a.add( new Point2D<String>( "-0.23", "34.7" ) );
		
		for (Point2D<?> x : a)
			System.out.println(" point data: " + x);
		
		ObjectOutputStream os = new ObjectOutputStream( new FileOutputStream( new File( filename ) ) );
		os.writeObject( a );
		os.close();
	}

}
